<template>
  <div class="main2">
    <div class="main-top">
      <div class="main-top-L">积水点动态水位监测</div>
      <div class="main-top-R" @click="checkMore">查看更多</div>
    </div>
    <div class="main-bottom">
      <el-table
        :data="dataa.list"
        border
        style="width: 100%"
        :header-cell-style="{ background: 'rgba(237, 242, 246, 1)' }"
      >

        <el-table-column prop="createTime" label="告警时间" width="180"></el-table-column>
        <el-table-column prop="warningStation" label="积水点" width="180"></el-table-column>
        <el-table-column label="告警类型" width="180">
          <template slot-scope="scope">
            <span
              :class="scope.row.warningType ==0?'green':'red'"
            >{{scope.row.warningType ==2?'电压告警':'水位告警'}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="warningMsg" label="告警内容"></el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 搜索
      search: {
        status: "",
        name: "",
        list: [],
        stationId: "",
        page: 1,
        size: 10
      },
      dataa: {
        pagesize: "",
        // currpage: "",
        list: []
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //获取列表数据
    getList() {
      console.log(localStorage.getItem("companyId"));

      this.$http
        .post("waterWarning/findList", {
          ...this.search,
          // companyId: "4"
          companyId: localStorage.getItem("companyId")
        })
        .then(res => {
          // console.log(res);
          this.dataa = res.data;
          // this.data.currpage = 1;
          // this.data.list = res.data;
        });
    },
    //查看更多
    checkMore(){
      this.$router.push('/warnrecord/index')
    }
  }
};
</script>

<style scoped lang="less">
.main2 {
  background: #fff;
  box-shadow: 0px 0px 10px 0px rgba(102, 102, 102, 0.3);
  height: 310px;
  .main-top {
    height: 38px;
    line-height: 38px;
    padding: 0 10px;
    .main-top-L {
      float: left;
      height: 38px;
      line-height: 38px;
      font-size: 16px;
      color: #000;
      font-weight: 500;
    }
    .main-top-R {
      float: right;
      height: 38px;
      line-height: 38px;
      cursor: pointer;
      .main-top-R-son {
        // background: red;
        border: 1px solid #000;
        height: 30px;
        margin-top: 8px;
        cursor: pointer;
      }
    }
  }
  .main-bottom{
    height: 100%;
    width: 100%;
    overflow-y: auto;
  }
}
</style>